#include<vector>
using namespace std;
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int i,j;
        for(i=0,j=0;j<nums.size();){
            if(nums[j]==nums[i]){
                j++;
            }
            else{
                nums[++i]=nums[j++];
            }
        }
        return i+1;
    }
};